document.addEventListener('click', function (event) {
  event.preventDefault();
  event.stopPropagation();
  
  const element = event.target;
  element.style.outline = '2px solid red';

  const elementInfo = {
    tagName: element.tagName,
    id: element.id,
    classList: Array.from(element.classList),
    innerText: element.innerText
  };

  console.log('Picked element:', elementInfo);

  chrome.runtime.sendMessage({ type: 'elementPicked', element: elementInfo });
}, true);
